home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Include / DShowIDL / Vmrender.idl < prev   
Encoding:
Text File  |  2002-11-12  |  31.6 KB  |  1,075 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Public Interfaces for the Video Mixing Renderer DShow filter
  4. //
  5. // Copyright (c) 1999 - 2002, Microsoft Corporation.  All rights reserved.
  6. ///////////////////////////////////////////////////////////////////////////////
  7.  
  8. cpp_quote("#if 0")
  9. // This is temporary work around to persuade
  10. // MIDL to allow forward declarations.
  11. typedef DWORD*    LPDIRECTDRAW7;
  12. typedef DWORD*    LPDIRECTDRAWSURFACE7;
  13. typedef DWORD*    LPDDPIXELFORMAT;
  14. typedef DWORD*    LPBITMAPINFOHEADER;
  15. typedef struct {DWORD dw1; DWORD dw2;} DDCOLORKEY;
  16. typedef DDCOLORKEY*    LPDDCOLORKEY;
  17. cpp_quote ("#endif")
  18. cpp_quote("#include <ddraw.h>")
  19.  
  20.  
  21. // public interfaces supported by the VMR
  22. interface IVMRSurface;
  23.  
  24. interface IVMRSurfaceAllocator;
  25. interface IVMRSurfaceAllocatorNotify;
  26. interface IVMRImagePresenter;
  27. interface IVMRImagePresenterConfig;
  28.  
  29. interface IVMRWindowlessControl;
  30. interface IVMRMixerControl;
  31. interface IVMRMixerBitmap;
  32. interface IVMRFilterConfig;
  33. interface IVMRAspectRatioControl;
  34. interface IVMRDeinterlaceControl;
  35. interface IVMRMonitorConfig;
  36.  
  37. interface IVMRImageCompositor;
  38.  
  39. interface IVMRVideoStreamControl;
  40.  
  41.  
  42.  
  43.  
  44. ///////////////////////////////////////////////////////////////////////////////
  45. //
  46. // Allocator Presenter interfaces
  47. //
  48. ///////////////////////////////////////////////////////////////////////////////
  49.  
  50.  
  51.  
  52. //=====================================================================
  53. //
  54. // IVMRImagePresenter
  55. //
  56. //=====================================================================
  57. typedef enum {
  58.     VMRSample_SyncPoint       = 0x00000001,
  59.     VMRSample_Preroll         = 0x00000002,
  60.     VMRSample_Discontinuity   = 0x00000004,
  61.     VMRSample_TimeValid       = 0x00000008,
  62. } VMRPresentationFlags;
  63.  
  64.  
  65. typedef struct tagVMRPRESENTATIONINFO {
  66.     DWORD                   dwFlags;
  67.     LPDIRECTDRAWSURFACE7    lpSurf;
  68.     REFERENCE_TIME          rtStart;
  69.     REFERENCE_TIME          rtEnd;
  70.     SIZE                    szAspectRatio;
  71.     RECT                    rcSrc;
  72.     RECT                    rcDst;
  73.     DWORD                   dwTypeSpecificFlags;
  74.     DWORD                   dwInterlaceFlags;
  75. } VMRPRESENTATIONINFO;
  76.  
  77. [
  78.     local,
  79.     object,
  80.     local,
  81.     uuid(CE704FE7-E71E-41fb-BAA2-C4403E1182F5),
  82.     helpstring("IVMRImagePresenter Interface"),
  83.     pointer_default(unique)
  84. ]
  85. interface IVMRImagePresenter : IUnknown
  86. {
  87.     HRESULT StartPresenting(
  88.         [in] DWORD_PTR dwUserID
  89.         );
  90.  
  91.     HRESULT StopPresenting(
  92.         [in] DWORD_PTR dwUserID
  93.         );
  94.  
  95.  
  96.     HRESULT PresentImage(
  97.         [in] DWORD_PTR dwUserID,
  98.         [in] VMRPRESENTATIONINFO* lpPresInfo
  99.         );
  100. };
  101.  
  102.  
  103. //=====================================================================
  104. //
  105. // IVMRSurfaceAllocator
  106. //
  107. //=====================================================================
  108.  
  109. typedef enum {
  110.     AMAP_PIXELFORMAT_VALID  = 0x01,
  111.     AMAP_3D_TARGET          = 0x02,
  112.     AMAP_ALLOW_SYSMEM       = 0x04,
  113.     AMAP_FORCE_SYSMEM       = 0x08,
  114.     AMAP_DIRECTED_FLIP      = 0x10,
  115.     AMAP_DXVA_TARGET        = 0x20
  116. } VMRSurfaceAllocationFlags;
  117.  
  118. typedef struct tagVMRALLOCATIONINFO {
  119.     DWORD                   dwFlags;
  120.     LPBITMAPINFOHEADER      lpHdr;
  121.     LPDDPIXELFORMAT         lpPixFmt;
  122.     SIZE                    szAspectRatio;
  123.     DWORD                   dwMinBuffers;
  124.     DWORD                   dwMaxBuffers;
  125.     DWORD                   dwInterlaceFlags;
  126.     SIZE                    szNativeSize;
  127. } VMRALLOCATIONINFO;
  128.  
  129. [
  130.     local,
  131.     object,
  132.     local,
  133.     uuid(31ce832e-4484-458b-8cca-f4d7e3db0b52),
  134.     helpstring("IVMRSurfaceAllocator Interface"),
  135.     pointer_default(unique)
  136. ]
  137. interface IVMRSurfaceAllocator : IUnknown
  138. {
  139.     HRESULT AllocateSurface(
  140.         [in] DWORD_PTR dwUserID,
  141.         [in] VMRALLOCATIONINFO* lpAllocInfo,
  142.         [in] [out] DWORD* lpdwActualBuffers,
  143.         [out] LPDIRECTDRAWSURFACE7 *lplpSurface
  144.         );
  145.  
  146.     HRESULT FreeSurface(
  147.         [in] DWORD_PTR dwID
  148.         );
  149.  
  150.     HRESULT PrepareSurface(
  151.         [in] DWORD_PTR dwUserID,
  152.         [in] LPDIRECTDRAWSURFACE7 lpSurface,
  153.         [in] DWORD dwSurfaceFlags
  154.         );
  155.  
  156.     HRESULT AdviseNotify(
  157.         [in] IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify
  158.         );
  159. };
  160.  
  161.  
  162. //=====================================================================
  163. //
  164. // IVMRSurfaceAllocatorNotify
  165. //
  166. //=====================================================================
  167. [
  168.     local,
  169.     object,
  170.     local,
  171.     uuid(aada05a8-5a4e-4729-af0b-cea27aed51e2),
  172.     helpstring("IVMRSurfaceAllocatorNotify Interface"),
  173.     pointer_default(unique)
  174. ]
  175. interface IVMRSurfaceAllocatorNotify : IUnknown
  176. {
  177.     HRESULT AdviseSurfaceAllocator(
  178.         [in] DWORD_PTR dwUserID,
  179.         [in] IVMRSurfaceAllocator* lpIVRMSurfaceAllocator
  180.         );
  181.  
  182.     HRESULT SetDDrawDevice(
  183.         [in] LPDIRECTDRAW7 lpDDrawDevice,
  184.         [in] HMONITOR hMonitor
  185.         );
  186.  
  187.     HRESULT ChangeDDrawDevice(
  188.         [in] LPDIRECTDRAW7 lpDDrawDevice,
  189.         [in] HMONITOR hMonitor
  190.         );
  191.  
  192.     HRESULT RestoreDDrawSurfaces();
  193.  
  194.     HRESULT NotifyEvent(
  195.         [in] LONG EventCode,
  196.         [in] LONG_PTR Param1,
  197.         [in] LONG_PTR Param2
  198.         );
  199.  
  200.     HRESULT SetBorderColor(
  201.         [in] COLORREF clrBorder
  202.         );
  203. };
  204.  
  205.  
  206.  
  207. ///////////////////////////////////////////////////////////////////////////////
  208. //
  209. // Application control and configuration interfaces
  210. //
  211. ///////////////////////////////////////////////////////////////////////////////
  212.  
  213.  
  214. //=====================================================================
  215. //
  216. // IVMRWindowlessControl
  217. //
  218. //=====================================================================
  219. typedef enum {
  220.     VMR_ARMODE_NONE,
  221.     VMR_ARMODE_LETTER_BOX
  222. } VMR_ASPECT_RATIO_MODE;
  223.  
  224. [
  225.     local,
  226.     object,
  227.     local,
  228.     uuid(0eb1088c-4dcd-46f0-878f-39dae86a51b7),
  229.     helpstring("IVMRWindowlessControl Interface"),
  230.     pointer_default(unique)
  231. ]
  232. interface IVMRWindowlessControl : IUnknown
  233. {
  234.     //
  235.     //////////////////////////////////////////////////////////
  236.     // Video size and position information
  237.     //////////////////////////////////////////////////////////
  238.     //
  239.     HRESULT GetNativeVideoSize(
  240.         [out] LONG* lpWidth,
  241.         [out] LONG* lpHeight,
  242.         [out] LONG* lpARWidth,
  243.         [out] LONG* lpARHeight
  244.         );
  245.  
  246.     HRESULT GetMinIdealVideoSize(
  247.         [out] LONG* lpWidth,
  248.         [out] LONG* lpHeight
  249.         );
  250.  
  251.     HRESULT GetMaxIdealVideoSize(
  252.         [out] LONG* lpWidth,
  253.         [out] LONG* lpHeight
  254.         );
  255.  
  256.     HRESULT SetVideoPosition(
  257.         [in] const LPRECT lpSRCRect,
  258.         [in] const LPRECT lpDSTRect
  259.         );
  260.  
  261.     HRESULT GetVideoPosition(
  262.         [out] LPRECT lpSRCRect,
  263.         [out] LPRECT lpDSTRect
  264.         );
  265.  
  266.     HRESULT GetAspectRatioMode(
  267.         [out] DWORD* lpAspectRatioMode
  268.         );
  269.  
  270.     HRESULT SetAspectRatioMode(
  271.         [in] DWORD AspectRatioMode
  272.         );
  273.  
  274.     //
  275.     //////////////////////////////////////////////////////////
  276.     // Display and clipping management
  277.     //////////////////////////////////////////////////////////
  278.     //
  279.     HRESULT SetVideoClippingWindow(
  280.         [in] HWND hwnd
  281.         );
  282.  
  283.     HRESULT RepaintVideo(
  284.         [in] HWND hwnd,
  285.         [in] HDC hdc
  286.         );
  287.  
  288.     HRESULT DisplayModeChanged();
  289.  
  290.  
  291.     //
  292.     //////////////////////////////////////////////////////////
  293.     // GetCurrentImage
  294.     //
  295.     // Returns the current image being displayed.  This images
  296.     // is returned in the form of packed Windows DIB.
  297.     //
  298.     // GetCurrentImage can be called at any time, also
  299.     // the caller is responsible for free the returned memory
  300.     // by calling CoTaskMemFree.
  301.     //
  302.     // Excessive use of this function will degrade video
  303.     // playback performed.
  304.     //////////////////////////////////////////////////////////
  305.     //
  306.     HRESULT GetCurrentImage(
  307.         [out] BYTE** lpDib
  308.         );
  309.  
  310.     //
  311.     //////////////////////////////////////////////////////////
  312.     // Border Color control
  313.     //
  314.     // The border color is color used to fill any area of the
  315.     // the destination rectangle that does not contain video.
  316.     // It is typically used in two instances.  When the video
  317.     // straddles two monitors and when the VMR is trying
  318.     // to maintain the aspect ratio of the movies by letter
  319.     // boxing the video to fit within the specified destination
  320.     // rectangle. See SetAspectRatioMode above.
  321.     //////////////////////////////////////////////////////////
  322.     //
  323.     HRESULT SetBorderColor(
  324.         [in] COLORREF Clr
  325.         );
  326.  
  327.     HRESULT GetBorderColor(
  328.         [out] COLORREF* lpClr
  329.         );
  330.  
  331.     //
  332.     //////////////////////////////////////////////////////////
  333.     // Color key control only meaningful when the VMR is using
  334.     // and overlay
  335.     //////////////////////////////////////////////////////////
  336.     //
  337.     HRESULT SetColorKey(
  338.         [in] COLORREF Clr
  339.         );
  340.  
  341.     HRESULT GetColorKey(
  342.         [out] COLORREF* lpClr
  343.         );
  344. };
  345.  
  346.  
  347.  
  348. //=====================================================================
  349. //
  350. // IVMRMixerControl
  351. //
  352. //=====================================================================
  353.  
  354. typedef enum {
  355.     MixerPref_NoDecimation                 = 0x00000001, // No decimation - full size
  356.     MixerPref_DecimateOutput               = 0x00000002, // decimate output by 2 in x & y
  357.     MixerPref_DecimateMask                 = 0x0000000F,
  358.  
  359.     MixerPref_BiLinearFiltering            = 0x00000010, // use bi-linear filtering
  360.     MixerPref_PointFiltering               = 0x00000020, // use point filtering
  361.     MixerPref_FilteringMask                = 0x000000F0, // OR of all above flags
  362.  
  363.     MixerPref_RenderTargetRGB              = 0x00000100,
  364.     MixerPref_RenderTargetYUV420           = 0x00000200,
  365.     MixerPref_RenderTargetYUV422           = 0x00000400,
  366.     MixerPref_RenderTargetYUV444           = 0x00000800, // AYUV render target.
  367.     MixerPref_RenderTargetReserved         = 0x0000F000, // 4 bits reserved for future use.
  368.     MixerPref_RenderTargetMask             = 0x0000FF00, // OR of all above flags
  369. } VMRMixerPrefs;
  370.  
  371. //
  372. //  Normalized relative rectangle
  373. //  Coordinate ranges: x=[0...1) y=[0...1)
  374. //  Where the output window goes from 0,0 (closed inclusive lower bound)
  375. //  to 1,1 (open exclusive upper bound)
  376. //
  377. typedef struct _NORMALIZEDRECT
  378. {
  379.     float left;
  380.     float top;
  381.     float right;
  382.     float bottom;
  383. } NORMALIZEDRECT, *PNORMALIZEDRECT;
  384.  
  385. [
  386.     local,
  387.     object,
  388.     local,
  389.     uuid(1c1a17b0-bed0-415d-974b-dc6696131599),
  390.     helpstring("IVMRMixerControl Interface"),
  391.     pointer_default(unique)
  392. ]
  393. interface IVMRMixerControl : IUnknown
  394. {
  395.     HRESULT SetAlpha(
  396.         [in] DWORD dwStreamID,
  397.         [in] float Alpha // Source alpha premultication factor (global alpha for source)
  398.         );
  399.  
  400.     HRESULT GetAlpha(
  401.         [in] DWORD dwStreamID,
  402.         [out] float* pAlpha
  403.         );
  404.  
  405.     HRESULT SetZOrder(
  406.         [in] DWORD dwStreamID,
  407.         [in] DWORD dwZ
  408.         );
  409.  
  410.     HRESULT GetZOrder(
  411.         [in] DWORD dwStreamID,
  412.         [out] DWORD* pZ
  413.         );
  414.  
  415.     HRESULT SetOutputRect(
  416.         [in] DWORD dwStreamID,
  417.         [in] const NORMALIZEDRECT *pRect
  418.         );
  419.  
  420.     HRESULT GetOutputRect(
  421.         [in] DWORD dwStreamID,
  422.         [out] NORMALIZEDRECT *pRect
  423.         );
  424.  
  425.     HRESULT SetBackgroundClr(
  426.         [in] COLORREF ClrBkg
  427.         );
  428.  
  429.     HRESULT GetBackgroundClr(
  430.         [in] COLORREF* lpClrBkg
  431.         );
  432.  
  433.     HRESULT SetMixingPrefs(
  434.         [in] DWORD dwMixerPrefs  // a combination of VMRMixingPrefFlags
  435.         );
  436.  
  437.     HRESULT GetMixingPrefs(
  438.         [out] DWORD* pdwMixerPrefs
  439.         );
  440. };
  441.  
  442.  
  443. ///////////////////////////////////////////////////////////////////////////////
  444. //
  445. // VMR Multimon configuration interface
  446. //
  447. ///////////////////////////////////////////////////////////////////////////////
  448. typedef struct tagVMRGUID {
  449.     GUID*       pGUID; // is NULL if the default DDraw device
  450.     GUID        GUID;   // otherwise points to this GUID
  451. } VMRGUID;
  452.  
  453. #define VMRDEVICENAMELEN 32
  454. #define VMRDEVICEDESCRIPTIONLEN  256
  455.  
  456. typedef struct tagVMRMONITORINFO {
  457.     VMRGUID     guid;
  458.     RECT        rcMonitor;
  459.     HMONITOR    hMon;
  460.     DWORD       dwFlags;    // described in MONITORINFOEX, currently only MONITORINFOF_PRIMARY
  461.     wchar_t     szDevice[VMRDEVICENAMELEN];
  462.     wchar_t     szDescription[VMRDEVICEDESCRIPTIONLEN];
  463.     LARGE_INTEGER liDriverVersion;
  464.     DWORD       dwVendorId;
  465.     DWORD       dwDeviceId;
  466.     DWORD       dwSubSysId;
  467.     DWORD       dwRevision;
  468.     // find out the DDCAPS using DDrawCreate on the monitor GUID
  469. } VMRMONITORINFO;
  470.  
  471. [
  472.     object,
  473.     local,
  474.     uuid(9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce),
  475.     helpstring("IVMRMonitorConfig Interface"),
  476.     pointer_default(unique)
  477. ]
  478. interface IVMRMonitorConfig : IUnknown
  479. {
  480.     // Use this method on a Multi-Monitor system to specify to the
  481.     // mixer filter which Direct Draw driver should be used when connecting
  482.     // to an upstream decoder filter.
  483.     //
  484.     HRESULT SetMonitor(
  485.         [in] const VMRGUID *pGUID
  486.         );
  487.  
  488.     // Use this method to determine the direct draw object that will be used when
  489.     // connecting the  mixer filter to an upstream decoder filter.
  490.     //
  491.     HRESULT GetMonitor(
  492.         [out] VMRGUID *pGUID
  493.         );
  494.  
  495.     // Use this method on a multi-monitor system to specify to the
  496.     //  mixer filter the default Direct Draw device to use when
  497.     // connecting to an upstream filter.  The default direct draw device
  498.     // can be overriden for a particular connection by SetMonitor method
  499.     // described above.
  500.     //
  501.     HRESULT SetDefaultMonitor(
  502.         [in] const VMRGUID *pGUID
  503.         );
  504.  
  505.     // Use this method on a multi-monitor system to determine which
  506.     // is the default direct draw device the overlay mixer filter
  507.     // will  use when connecting to an upstream filter.
  508.     //
  509.     HRESULT GetDefaultMonitor(
  510.         [out] VMRGUID *pGUID
  511.         );
  512.  
  513.     // Use this method to get a list of Direct Draw device GUIDs and thier
  514.     // associated monitor information that the mixer can use when
  515.     // connecting to an upstream decoder filter.  Passing down a NULL pInfo
  516.     // parameter allows the app to determine the required array size (returned
  517.     // in pdwNumDevices).  Otherwise, dwNumDevices returns the actual
  518.     // number of devices retrieved.
  519.     //
  520.     HRESULT GetAvailableMonitors(
  521.         [out, size_is(dwMaxInfoArraySize)] VMRMONITORINFO* pInfo,
  522.         [in] DWORD dwMaxInfoArraySize, // in array members
  523.         [out] DWORD* pdwNumDevices // actual number of devices retrieved
  524.         );
  525. };
  526.  
  527.  
  528.  
  529.  
  530. ///////////////////////////////////////////////////////////////////////////////
  531. //
  532. // VMR Filter configuration interfaces
  533. //
  534. ///////////////////////////////////////////////////////////////////////////////
  535.  
  536.  
  537. typedef enum {
  538.     RenderPrefs_RestrictToInitialMonitor     = 0x00000000, // not implemented do not use
  539.     RenderPrefs_ForceOffscreen               = 0x00000001,
  540.     RenderPrefs_ForceOverlays                = 0x00000002, // fail if no overlays
  541.     RenderPrefs_AllowOverlays                = 0x00000000, // overlay used by default
  542.     RenderPrefs_AllowOffscreen               = 0x00000000, // offscreen used if no overlay
  543.     RenderPrefs_DoNotRenderColorKeyAndBorder = 0x00000008, // app paints color keys
  544.     RenderPrefs_Reserved                     = 0x00000010, // note: used to be RestrictToInitialMonitor
  545.     RenderPrefs_PreferAGPMemWhenMixing       = 0x00000020, // try agp mem when allocating textures
  546.  
  547.     RenderPrefs_Mask                         = 0x0000003f, // OR of all above flags
  548. } VMRRenderPrefs;
  549.  
  550. typedef enum {
  551.     VMRMode_Windowed                         = 0x00000001,
  552.     VMRMode_Windowless                       = 0x00000002,
  553.     VMRMode_Renderless                       = 0x00000004,
  554.  
  555.     // not a valid value to pass to SetRenderMode
  556.     VMRMode_Mask                             = 0x00000007, // OR of all above flags
  557. } VMRMode;
  558.  
  559. enum {
  560.         MAX_NUMBER_OF_STREAMS = 16
  561. };
  562.  
  563. [
  564.     object,
  565.     local,
  566.     uuid(9e5530c5-7034-48b4-bb46-0b8a6efc8e36),
  567.     helpstring("IVMRFilterConfig Interface"),
  568.     pointer_default(unique)
  569. ]
  570. interface IVMRFilterConfig : IUnknown
  571. {
  572.     HRESULT SetImageCompositor(
  573.         [in] IVMRImageCompositor* lpVMRImgCompositor
  574.         );
  575.  
  576.     HRESULT SetNumberOfStreams(
  577.         [in] DWORD dwMaxStreams
  578.         );
  579.  
  580.     HRESULT GetNumberOfStreams(
  581.         [out] DWORD* pdwMaxStreams
  582.         );
  583.  
  584.     HRESULT SetRenderingPrefs(
  585.         [in] DWORD dwRenderFlags  // a combination of VMRRenderingPrefFlags
  586.         );
  587.  
  588.     HRESULT GetRenderingPrefs(
  589.         [out] DWORD* pdwRenderFlags
  590.         );
  591.  
  592.     HRESULT SetRenderingMode(
  593.         [in] DWORD Mode  // a combination of VMRMode
  594.         );
  595.  
  596.     HRESULT GetRenderingMode(
  597.         [out] DWORD* pMode
  598.         );
  599. }
  600.  
  601.  
  602. //=====================================================================
  603. //
  604. // IVMRAspectRatioControl
  605. //
  606. //=====================================================================
  607. [
  608.     object,
  609.     local,
  610.     uuid(ede80b5c-bad6-4623-b537-65586c9f8dfd),
  611.     helpstring("IVMRAspectRatioControl Interface"),
  612.     pointer_default(unique)
  613. ]
  614. interface IVMRAspectRatioControl : IUnknown
  615. {
  616.     HRESULT GetAspectRatioMode(
  617.         [out] LPDWORD lpdwARMode
  618.             );
  619.  
  620.     HRESULT SetAspectRatioMode(
  621.         [in] DWORD dwARMode
  622.             );
  623. }
  624.  
  625.  
  626. //=====================================================================
  627. //
  628. // IVMRDeinterlaceControl
  629. //
  630. // New interfaced introduced into the WindowsXP SP1 release of the VMR.
  631. // This interface allows applications to control the DX-VA deinterlacing
  632. // support provided by the VMR.
  633. //
  634. // The VMR needs to be set into "mixing" mode for this interface to work.
  635. //
  636. // SetDeinterlaceMode is only effective for new connections made to the
  637. // VMR.  It should be noted that the graphics device driver may refuse
  638. // to use the specified deinterlace mode, in which case 3 fallback
  639. // policies are offered by the VMR, these being:
  640. //
  641. //      1. Fallback to the next best mode offered by the driver.
  642. //      2. Fallback to the BOB deinterlace mode.
  643. //      3. Fallback to the WEAVE deinterlace mode (ie. turn deinterlacing off).
  644. //
  645. //=====================================================================
  646.  
  647. typedef enum {
  648.     DeinterlacePref_NextBest = 0x01,
  649.     DeinterlacePref_BOB = 0x02,
  650.     DeinterlacePref_Weave = 0x04,
  651.     DeinterlacePref_Mask = 0x07
  652. } VMRDeinterlacePrefs;
  653.  
  654. typedef enum {
  655.  
  656.     // the algorithm is unknown or proprietary
  657.     DeinterlaceTech_Unknown                = 0x0000,
  658.  
  659.     // the algorithm creates the missing lines by repeating
  660.     // the line either above or below it - this method will look very jaggy and
  661.     // isn't recommended
  662.     DeinterlaceTech_BOBLineReplicate       = 0x0001,
  663.  
  664.  
  665.     // the algorithm creates the missing lines by vertically stretching each
  666.     // video field by a factor of two, for example by averaging two lines or
  667.     // using a [-1, 9, 9, -1]/16 filter across four lines.
  668.     // Slight vertical adjustments are made to ensure that the resulting image
  669.     // does not "bob" up and down.
  670.     DeinterlaceTech_BOBVerticalStretch     = 0x0002,
  671.  
  672.     // the pixels in the missing line are recreated by a median filtering operation
  673.     DeinterlaceTech_MedianFiltering        = 0x0004,
  674.  
  675.     // the pixels in the missing line are recreated by an edge filter.
  676.     // In this process, spatial directional filters are applied to determine
  677.     // the orientation of edges in the picture content, and missing
  678.     // pixels are created by filtering along (rather than across) the
  679.     // detected edges.
  680.     DeinterlaceTech_EdgeFiltering          = 0x0010,
  681.  
  682.     // the pixels in the missing line are recreated by switching on a field by
  683.     // field basis between using either spatial or temporal interpolation
  684.     // depending on the amount of motion.
  685.     DeinterlaceTech_FieldAdaptive          = 0x0020,
  686.  
  687.     // the pixels in the missing line are recreated by switching on a pixel by pixel
  688.     // basis between using either spatial or temporal interpolation depending on
  689.     // the amount of motion..
  690.     DeinterlaceTech_PixelAdaptive          = 0x0040,
  691.  
  692.     // Motion Vector Steering  identifies objects within a sequence of video
  693.     // fields.  The missing pixels are recreated after first aligning the
  694.     // movement axes of the individual objects in the scene to make them
  695.     // parallel with the time axis.
  696.     DeinterlaceTech_MotionVectorSteered      = 0x0080
  697.  
  698. } VMRDeinterlaceTech;
  699.  
  700. typedef struct _VMRFrequency {
  701.     DWORD dwNumerator;
  702.     DWORD dwDenominator;
  703. } VMRFrequency;
  704.  
  705. typedef struct _VMRVideoDesc {
  706.     DWORD               dwSize;
  707.     DWORD               dwSampleWidth;
  708.     DWORD               dwSampleHeight;
  709.     BOOL                SingleFieldPerSample;
  710.     DWORD               dwFourCC;
  711.     VMRFrequency        InputSampleFreq;
  712.     VMRFrequency        OutputFrameFreq;
  713. } VMRVideoDesc;
  714.  
  715. typedef struct _VMRDeinterlaceCaps {
  716.     DWORD               dwSize;
  717.     DWORD               dwNumPreviousOutputFrames;
  718.     DWORD               dwNumForwardRefSamples;
  719.     DWORD               dwNumBackwardRefSamples;
  720.     VMRDeinterlaceTech  DeinterlaceTechnology;
  721. } VMRDeinterlaceCaps;
  722.  
  723. [
  724.     object,
  725.     local,
  726.     uuid(bb057577-0db8-4e6a-87a7-1a8c9a505a0f),
  727.     helpstring("IVMRDeinterlaceControl Interface"),
  728.     pointer_default(unique)
  729. ]
  730. interface IVMRDeinterlaceControl : IUnknown
  731. {
  732.     //
  733.     // For the specified video description returns the
  734.     // number of deinterlacing modes available to the VMR.
  735.     // The deinterlacing modes are returned in descending
  736.     // quality order ie. the best quality mode is at
  737.     // lpdwNumDeinterlaceModes[0], the next best at
  738.     // lpdwNumDeinterlaceModes[1] and so on.
  739.     //
  740.     // To determine how big an array of guids to pass to the
  741.     // GetNumberOfDeinterlaceModes method call
  742.     // GetNumberOfDeinterlaceModes(lpVideoDescription, &dwNumModes, NULL);
  743.     //
  744.     HRESULT GetNumberOfDeinterlaceModes(
  745.         [in] VMRVideoDesc* lpVideoDescription,
  746.         [in] [out] LPDWORD lpdwNumDeinterlaceModes,
  747.         [out] LPGUID lpDeinterlaceModes
  748.         );
  749.  
  750.     //
  751.     // For the given video description get the capabilities of the
  752.     // specified de-interlace mode.
  753.     //
  754.     HRESULT GetDeinterlaceModeCaps(
  755.         [in] LPGUID lpDeinterlaceMode,
  756.         [in] VMRVideoDesc* lpVideoDescription,
  757.         [in] [out] VMRDeinterlaceCaps* lpDeinterlaceCaps
  758.         );
  759.  
  760.     //
  761.     // Get/Set the deinterlace mode that you would like the
  762.     // VMR to use when de-interlacing the specified stream.
  763.     // It should be noted that the VMR may not actually be able
  764.     // to use the requested deinterlace mode, in which case the
  765.     // the VMR will fall back to other de-interlace modes as specified
  766.     // by the de-interlace preferences (see SetDeinterlacePrefs below).
  767.     //
  768.     HRESULT GetDeinterlaceMode(
  769.         [in] DWORD dwStreamID,
  770.         [out] LPGUID lpDeinterlaceMode  // returns GUID_NULL if SetDeinterlaceMode
  771.         );                              // has not been called yet.
  772.  
  773.     HRESULT SetDeinterlaceMode(
  774.         [in] DWORD dwStreamID,          // use 0xFFFFFFFF to set mode for all streams
  775.         [in] LPGUID lpDeinterlaceMode   // GUID_NULL == turn deinterlacing off
  776.         );
  777.  
  778.  
  779.     HRESULT GetDeinterlacePrefs(
  780.         [out] LPDWORD lpdwDeinterlacePrefs
  781.         );
  782.  
  783.     HRESULT SetDeinterlacePrefs(
  784.         [in] DWORD dwDeinterlacePrefs
  785.         );
  786.  
  787.     //
  788.     // Get the DeinterlaceMode currently in use for the specified
  789.     // video stream (ie. pin).  The returned GUID will be NULL if
  790.     // the de-interlacing h/w has not been created by the VMR at the
  791.     // time the function is called, or if the VMR determines that
  792.     // this stream should not or can be de-interlaced.
  793.     //
  794.     HRESULT GetActualDeinterlaceMode(
  795.         [in] DWORD dwStreamID,
  796.         [out] LPGUID lpDeinterlaceMode
  797.         );
  798. }
  799.  
  800.  
  801. //=====================================================================
  802. //
  803. // IVMRMixerBitmap
  804. //
  805. //=====================================================================
  806. typedef struct _VMRALPHABITMAP
  807. {
  808.     DWORD                   dwFlags;    // flags word
  809.     HDC                     hdc;        // DC for the bitmap to copy
  810.     LPDIRECTDRAWSURFACE7    pDDS;       // DirectDraw surface to copy
  811.     RECT                    rSrc;       // rectangle to copy from the DC/DDS
  812.     NORMALIZEDRECT          rDest;      // output rectangle in composition space
  813.     FLOAT                fAlpha;     // opacity of the bitmap
  814.     COLORREF                clrSrcKey;  // src color key
  815. } VMRALPHABITMAP, *PVMRALPHABITMAP;
  816.  
  817. // Disable the alpha bitmap for now
  818. cpp_quote("#define VMRBITMAP_DISABLE            0x00000001")
  819.  
  820. // Take the bitmap from the HDC rather than the DirectDraw surface
  821. cpp_quote("#define VMRBITMAP_HDC                0x00000002")
  822.  
  823. // Take the entire DDraw surface - rSrc is ignored
  824. cpp_quote("#define VMRBITMAP_ENTIREDDS          0x00000004")
  825.  
  826. // Indicates that the clrTrans value is valid and should be
  827. // used when blending
  828. cpp_quote("#define VMRBITMAP_SRCCOLORKEY        0x00000008")
  829.  
  830. // Indicates that the rSrc rectangle is valid and specifies a
  831. // sub-rectangle of the of original app image to be blended.
  832. // Use of this parameter enables "Image Strips"
  833. cpp_quote("#define VMRBITMAP_SRCRECT            0x00000010")
  834.  
  835. [
  836.     object,
  837.     local,
  838.     uuid(1E673275-0257-40aa-AF20-7C608D4A0428),
  839.     helpstring("IVMRMixerBitmap Interface"),
  840.     pointer_default(unique)
  841. ]
  842. interface IVMRMixerBitmap : IUnknown
  843. {
  844.     // Set bitmap, location to blend it, and blending value
  845.     HRESULT SetAlphaBitmap(
  846.         [in] const VMRALPHABITMAP *pBmpParms
  847.         );
  848.  
  849.     // Change bitmap location, size and blending value,
  850.     // graph must be running for change to take effect.
  851.     HRESULT UpdateAlphaBitmapParameters(
  852.         [in] PVMRALPHABITMAP pBmpParms
  853.         );
  854.  
  855.     // Get bitmap, location to blend it, and blending value
  856.     HRESULT GetAlphaBitmapParameters(
  857.         [out] PVMRALPHABITMAP pBmpParms
  858.         );
  859. };
  860.  
  861.  
  862.  
  863.  
  864.  
  865. //=====================================================================
  866. //
  867. // IVMRImageCompositor
  868. //
  869. //=====================================================================
  870.  
  871. typedef struct _VMRVIDEOSTREAMINFO {
  872.     LPDIRECTDRAWSURFACE7        pddsVideoSurface;
  873.     DWORD                       dwWidth, dwHeight;
  874.     DWORD                       dwStrmID;
  875.     FLOAT                       fAlpha;
  876.     DDCOLORKEY                  ddClrKey;
  877.     NORMALIZEDRECT              rNormal;
  878. } VMRVIDEOSTREAMINFO;
  879. [
  880.     local,
  881.     object,
  882.     local,
  883.     uuid(7a4fb5af-479f-4074-bb40-ce6722e43c82),
  884.     helpstring("IVMRImageCompositor Interface"),
  885.     pointer_default(unique)
  886. ]
  887. interface IVMRImageCompositor : IUnknown
  888. {
  889.     HRESULT InitCompositionTarget(
  890.         [in] IUnknown* pD3DDevice,
  891.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
  892.         );
  893.  
  894.     HRESULT TermCompositionTarget(
  895.         [in] IUnknown* pD3DDevice,
  896.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
  897.         );
  898.  
  899.     HRESULT SetStreamMediaType(
  900.         [in] DWORD dwStrmID,
  901.         [in] AM_MEDIA_TYPE* pmt,
  902.         [in] BOOL fTexture
  903.         );
  904.  
  905.     HRESULT CompositeImage(
  906.         [in] IUnknown* pD3DDevice,
  907.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget,
  908.         [in] AM_MEDIA_TYPE* pmtRenderTarget,
  909.         [in] REFERENCE_TIME rtStart,
  910.         [in] REFERENCE_TIME rtEnd,
  911.         [in] DWORD dwClrBkGnd,
  912.         [in] VMRVIDEOSTREAMINFO* pVideoStreamInfo,
  913.         [in] UINT cStreams
  914.         );
  915. };
  916.  
  917.  
  918.  
  919. //=====================================================================
  920. //
  921. // IVMRVideoStreamControl
  922. //
  923. //=====================================================================
  924. [
  925.     object,
  926.     local,
  927.     uuid(058d1f11-2a54-4bef-bd54-df706626b727),
  928.     helpstring("IVMRMixerStreamConfig Interface"),
  929.     pointer_default(unique)
  930. ]
  931. interface IVMRVideoStreamControl: IUnknown
  932. {
  933.     HRESULT SetColorKey(
  934.         [in] LPDDCOLORKEY lpClrKey // Source color key, set to 0xFFFFFFFF to disable
  935.         );
  936.  
  937.     HRESULT GetColorKey(
  938.         [out] LPDDCOLORKEY lpClrKey
  939.         );
  940.  
  941.  
  942.     HRESULT SetStreamActiveState(
  943.         [in] BOOL fActive
  944.         );
  945.  
  946.     HRESULT GetStreamActiveState(
  947.         [out] BOOL* lpfActive
  948.         );
  949. };
  950.  
  951.  
  952.  
  953. //=====================================================================
  954. //
  955. // IVMRSurface
  956. //
  957. //=====================================================================
  958. [
  959.     local,
  960.     object,
  961.     local,
  962.     uuid(a9849bbe-9ec8-4263-b764-62730f0d15d0),
  963.     helpstring("IVMRSurface Interface"),
  964.     pointer_default(unique)
  965. ]
  966. interface IVMRSurface : IUnknown
  967. {
  968.     HRESULT IsSurfaceLocked();
  969.  
  970.     HRESULT LockSurface(
  971.         [out] BYTE** lpSurface
  972.         );
  973.  
  974.     HRESULT UnlockSurface();
  975.  
  976.     HRESULT GetSurface(
  977.         [out] LPDIRECTDRAWSURFACE7 *lplpSurface
  978.         );
  979. };
  980.  
  981.  
  982.  
  983. //=====================================================================
  984. //
  985. // IID_IVMRImagePresenterConfig - this interface allows applications
  986. // to configure the default Microsoft provided allocator-presenter
  987. // inorder to simplify the implementation of their own
  988. // allocator-presenter plug-in.
  989. //
  990. //=====================================================================
  991. [
  992.     local,
  993.     object,
  994.     local,
  995.     uuid(9f3a1c85-8555-49ba-935f-be5b5b29d178),
  996.     helpstring("IVMRImagePresenterConfig Interface"),
  997.     pointer_default(unique)
  998. ]
  999.  
  1000. interface IVMRImagePresenterConfig : IUnknown
  1001. {
  1002.  
  1003.     HRESULT SetRenderingPrefs(
  1004.         [in] DWORD dwRenderFlags   // see VMRRenderPrefs for valid flags
  1005.         );
  1006.  
  1007.     HRESULT GetRenderingPrefs(
  1008.         [out] DWORD* dwRenderFlags // see VMRRenderPrefs for valid flags
  1009.         );
  1010.  
  1011. }
  1012.  
  1013. //=====================================================================
  1014. //
  1015. // IID_IVMRImagePresenterExclModeConfig - this interface allows applications
  1016. // to configure the DDraw exclusive mode allocator-presenter.  This
  1017. // interface extends the IVMRImagePresenterConfig interface defined
  1018. // above and is only implemented by the CLSID_AllocPresenterDDXclMode
  1019. // allocator-presenter object.
  1020. //
  1021. //=====================================================================
  1022. [
  1023.     local,
  1024.     object,
  1025.     local,
  1026.     uuid(e6f7ce40-4673-44f1-8f77-5499d68cb4ea),
  1027.     helpstring("IVMRImagePresenterExclModeConfig Interface"),
  1028.     pointer_default(unique)
  1029. ]
  1030.  
  1031. interface IVMRImagePresenterExclModeConfig : IVMRImagePresenterConfig
  1032. {
  1033.     HRESULT SetXlcModeDDObjAndPrimarySurface(
  1034.         [in] LPDIRECTDRAW7 lpDDObj,
  1035.         [in] LPDIRECTDRAWSURFACE7 lpPrimarySurf
  1036.         );
  1037.  
  1038.     HRESULT GetXlcModeDDObjAndPrimarySurface(
  1039.         [out] LPDIRECTDRAW7* lpDDObj,
  1040.         [out] LPDIRECTDRAWSURFACE7* lpPrimarySurf
  1041.         );
  1042. }
  1043.  
  1044.  
  1045. //=====================================================================
  1046. //
  1047. // IVPManager
  1048. //
  1049. //=====================================================================
  1050. [
  1051.     local,
  1052.     object,
  1053.     local,
  1054.     uuid(aac18c18-e186-46d2-825d-a1f8dc8e395a),
  1055.     helpstring("IVPManager Interface"),
  1056.     pointer_default(unique)
  1057. ]
  1058. interface IVPManager : IUnknown
  1059. {
  1060.     // Use this method on a Multi-Monitor system to specify to the
  1061.     // video port manager filter which videoport index is used
  1062.     // to an upstream decoder filter.
  1063.     //
  1064.     HRESULT SetVideoPortIndex(
  1065.         [in] DWORD dwVideoPortIndex // the video port number that this is connected to
  1066.         );
  1067.  
  1068.     // This method returns the current video port index being used by the VPM.
  1069.     //
  1070.     HRESULT GetVideoPortIndex(
  1071.         [out] DWORD* pdwVideoPortIndex // the video port number that this is connected to
  1072.         );
  1073. };
  1074.  
  1075.